﻿using System;
using System.Collections.Generic;

using E.Web;
using E.BLL;
using E.Web.UI.Page;

using X.Common;

namespace E.Web.training.exam
{
    public partial class Skip : BasePage
    {
        protected override void ShowPage()
        {
            IList<int> idList = (new ExamBLL()).GetCertificateTestID(userid, areaid);
            if (idList.Count > 0)
            {
                if (idList.Count == 1)
                {
                    if (idList[0] != -1)
                    {
                        System.Web.HttpContext.Current.Response.Redirect("/training/exam/Test.aspx?examid=" + idList[0] + "&cid=2");
                    }
                    else
                    {
                        ExecuteJS("alert('提交错误');");
                    }
                }
                else
                {
                    Random r = new Random();
                    int id = idList[r.Next(0, idList.Count)];
                    System.Web.HttpContext.Current.Response.Redirect("/training/exam/Test.aspx?examid=" + id + "&cid=2");
                }
            }
            else
            {
                Alert("很抱歉，目前还没有能够参加的考试");
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}
